class ApplicationController < ActionController::Base
  protect_from_forgery
  
  
  
  protected
  def admin_authorize
      unless @user = User.find_by_id(session[:user_id]) and @user.user_type == 'admin'
        redirect_to home_url
      end
  end
  
  def librarian_authorize
      unless @user = User.find_by_id(session[:user_id]) and @user.user_type == 'librarian'
        redirect_to home_url
      end
  end
  
  def student_authorize
      unless @user = User.find_by_id(session[:user_id]) and @user.user_type == 'student'
        redirect_to home_url
      end
  end
  
  
  
end
